<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>结账页面</title>
	<link rel="stylesheet" href="<%=basePath%>css/common_new.min.css">
	<link rel="stylesheet"
		href="<%=basePath%>static/css/owl.carousel.min.css">
	<link rel="stylesheet" href="<%=basePath%>css/zupin03.css">
	<script src="<%=basePath%>static/js/jquery.min.js"></script>
	
	<script rel="script" src="<%=basePath%>js/vue.min.js"></script>
	<link rel="stylesheet"
		href="//at.alicdn.com/t/font_699355_5fafq7zsd2fq1tt9.css">
	<link rel="stylesheet" href="<%=basePath%>css/index.css">
	<script type="text/javascript" src="<%=basePath%>js/kefu.js"></script>
<style type="text/css">
.row form .shangpin {
  height: 30px;
  background: #f5f5f5;
}
</style>
</head>

<body>
	<!-- 顶部导航栏 -->
	<section>
		<div id="header">

			<div class="navbar">
				<div class="navbar-content">
					<jsp:include page="yeah-top.jsp" />
				</div>
			</div>
			<div class="daohang">
				<a href="<%=basePath%>">首页</a> <span>></span> <a href="<%=basePath%>leaseitem">低价租赁</a> <span>></span>
				<a href="#">套餐一</a>
			</div>
		</div>
	</section>

	<section>
		<div class="row">
			<p>收货信息</p>
			<form action="addr" method="post" id="formId" style="height: 800px;" onsubmit="return sub()">
				<div class="formz">
					<div class="form1" id="td3">
						<p>
							<span>所在地区：</span> <select class="demo" id="province"
								onchange="getCity()" name="state">
								<option>
									<c:if test="${address.state!=null}">${address.state }</c:if>
									<c:if test="${address.state==null}">请选择</c:if>
								</option>
							</select> <select class="demo" id="city" onchange="getDown()"
								name="city">
								<option>
									<c:if test="${address.city!=null}">${address.city }</c:if>
									<c:if test="${address.city==null}">请选择</c:if>
								</option>
							</select> <select class="demo" id="area" name="district">
								<option>
									<c:if test="${address.district!=null}">${address.district }</c:if>
									<c:if test="${address.district==null}">请选择</c:if>
								</option>
							</select>
						</p>
						<p>
							<span>详细地址：</span>
							<textarea rows="8" cols="40" id="address" name="address">${address.address }</textarea>
						</p>
						<p style="margin-left: 13px;">
							<span>收货人：</span> <input type="text" name="name" value="${address.name }"> <span
								style="margin-left: 13px;">手机号码：</span> <input type="text" name="phone" value="${address.phone }">
						</p>
						<p style="margin-left: 27px;">
							<span>留言：</span>
							<textarea rows="8" cols="40" id="liuyan" name="liuyan"></textarea>
						</p>
					</div>
					<div class="form2">
						<input class="baocun" type="submit" value="保存地址">
					</div>
				</div>
			
				<div class="shangpin">
					<ul>
						<li>商品信息</li>
						<li>单价</li>
						<li>显示器</li>
						<li>数量</li>
						<li>时长</li>
						<li>押金</li>
						<li>小计</li>
					</ul>
					<div>
						<ul class="shangpinz">
							<li class="li1"><img src="${item.img }">
								<span>${zlo.combo_name }</span></li>
							<li style="margin-left: 135px;">
								<p>
									￥${zlo.danjia*item.zheko }一天 <span class="shanchu">￥${zlo.danjia }一天</span>
								</p>
								<p class="xian">
									<span>限时${item.zheko }折</span>
								</p>
							</li>
							<li>
								<p>￥${zlo.xsqj }/天</p>
								<p class="xian">
									<span>限时优惠</span>
								</p>
							</li>
							<li style="margin-left: 75px;">${zlo.num }</li>
							<li style="margin-left: 85px;">${zlo.time }</li>
							<li>
								<p>
									￥${zlo.yaj }一台 <span class="shanchu">￥${item.yajin }一台</span>
								</p>
								<p class="xian">
								<c:if test="${genders==4 }">
									<span>公司租赁10台以上五折</span>
								</c:if>
								<c:if test="${genders==2 }">
									<span>个人租赁3台以上八折</span>
								</c:if>
								<c:if test="${genders==5 }">
									<span>学生租赁免一台押金</span>
								</c:if>
								</p>
							</li>
							<li style="margin-left: 10px;">￥${ord.payment }</li>
						</ul>
					</div>
				</div>
				<div class="but1">
					<p>
						商品合计 <span>￥${ord.payment }</span>
					</p>
					<p>
						运费 <span>￥0</span>
					</p>
					<p>
						应付总额 <span class="zong">￥${ord.payment }</span>
					</p>
					<a href="javascript:void(0);" onclick="yanz('${ord.oid }')"><input type="button" value="去付款"></a>
				</div>
			</form>
			<script>
				
			</script>

		</div>

	</section>

	<!-- 底部 -->
	<section>
		<jsp:include page="bottom.jsp" />
	</section>
	<script src="<%=basePath%>js/zupin03.js"></script>
	<script src="<%=basePath%>static/js/inquiry.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/province.js"></script>
	<script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
	<script type="text/javascript">
		var province = p.province;		
		$(function() {							
			for (var i = 0; i < province.length; i++) {								
				$("#province").append(
						"<option>" + province[i].name
								+ "</option>");
			}
		});
		
		
		//省份值改变事件
		function getCity() {
			//获取省份
			var s = $("#province").val();
			$("#city").empty();
			$("#area").empty();
			$("#city").append("<option>请选择</option>");
			$("#area").append("<option>请选择</option>");
			//获取省份下所有的市县
			for (var i = 0; i < province.length; i++) {
				if (s == province[i].name) {
					for (var j = 0; j < province[i].city.length; j++) {
						$("#city").append(
								"<option>" + province[i].city[j].name
										+ "</option>");
					}

				}

			}
		}
		
		function getDown() {
			//获取省份
			$("#area").empty();
			//$("#area").append("<option>请选择</option>");
			var s = $("#province").val();
			var c = $("#city").val();
			//获取省份下所有的市县
			for (var i = 0; i < province.length; i++) {
				if (s == province[i].name) {
					for (var j = 0; j < province[i].city.length; j++) {
						if (c == province[i].city[j].name) {
							for (var k = 0; k < province[i].city[j].area.length; k++) {
								$("#area").append(
										"<option>"
												+ province[i].city[j].area[k]
												+ "</option>");
							}

						}

					}

				}

			}

		}
		var fale = false;
		function sub() {  
	        // jquery 表单提交   
	       $.ajax({  
                cache: true,  
                type: "POST",  
                url:"addr",  
                data:$('#formId').serialize(),// 你的formid  
                async: false,  
                error: function(request) {  
                      
                },  
                success: function(data) {  
                	fale = true;
                	layer.msg("保存成功",{icon: 1,time:2000});  
                }  
            });   
	        return false;
	    }   
		
		function yanz(oid){
			if(fale){
				
				window.location.href="fk?oid="+oid ;
			}else{
				$.post("yanz",function(data){
					if(data){
						
						window.location.href="fk?oid="+oid ;
					}else{
						layer.msg("请先保存地址",{icon: 1,time:2000});
					}
				},"json");
			}
		}  
		
	</script>
</body>

</html>